package com.db4o.odbgen.plugins.java.enhancements;

import java.util.ArrayList;
import java.util.List;

import com.db4o.odbgen.plugins.java.maingenerator.typedxmlschema.TSClass;
import com.db4o.odbgen.plugins.java.maingenerator.typedxmlschema.TSField;


/**
 * Holds a field that will be used to build the SodaGraph.
 * @author liviug
 *
 */
public class SodaGraphField {
	private TSField _field;
	private TSClass _associatedSgInnerClass;
	private String _associatedSgInnerClassContent;
	private List<String> _fieldPath = new ArrayList<String>();

	public void setField(TSField field) {
		this._field = field;
	}

	public TSField getField() {
		return _field;
	}

	public void setAssociatedSgInnerClass(TSClass associatedClass) {
		this._associatedSgInnerClass = associatedClass;
	}

	/**
	 * Returns the SodaGraph non top level inner class associated with the field.
	 * This may be null if there is no class associated with the field.
	 * This hapens if the type of this field is not part of XmlSchema.
	 * @return
	 */
	public TSClass getAssociatedSgInnerClass() {
		return _associatedSgInnerClass;
	}

	public void setAssociatedSgInnerClassContent(String associatedClassContent) {
		this._associatedSgInnerClassContent = associatedClassContent;
	}

	/**
	 * The contents of the SodaGraph top level inner class associated with the field.
	 */
	public String getAssociatedSgInnerClassContent() {
		return _associatedSgInnerClassContent;
	}

//TODO: remove this.
//	public void setFieldPath(List<String> fieldPath) {
//		this._fieldPath = fieldPath;
//	}

	/**
	 * When we generate a constraint method for a field, we need the path of that field.
	 * @return
	 */
	public List<String> getFieldPath() {
		return _fieldPath;
	}
}
